package com.newhopegroup.webcommons.utils;

import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

/**
 * Created by wangshida on 15/7/30.
 */
public class EasyBeanUtils {
    /**
     * 将对象属性转换为Map结构
     * @param bean
     * @return
     * @throws IllegalAccessException
     * @throws NoSuchMethodException
     * @throws InvocationTargetException
     */
    public static Map<String, String> describe(Object bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        Map<String, String> o = BeanUtils.describe(bean);
        o.remove("class");

        return o;
    }
}
